package com.lst.api.config;

import com.lst.api.interceptor.ClientInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author: Frank
 * @date: 2019/10/25 15:13
 * @version: V1.0
 */
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getClientInterceptor()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }

    @Bean
    ClientInterceptor getClientInterceptor() {
        return new ClientInterceptor();
    }
}
